<?PHP
    require_once('../controller/ControllerCategoria.php');
    require_once('../model/Categoria.php');

    if(!empty($_POST['txtNome']))
    {
        $objController = new ControllerCategoria();
        
        $objBean = new Categoria();
        $objBean->setCategoria($_POST['txtNome']);
       
        if($objController->insert($objBean))
        {
           header('Location: CategoriaCadastrar.php?cadastrou=1');
        }
    }
    else
    {
        header('Location: CategoriaCadastrar.php?cadastrou=2');
    }
    	    
?>